AlaskaLinuxUser's Scratchpad

Commit thy works unto the LORD, and thy thoughts shall be established. - Proverbs 16:3

Updating older apps

20260615.png

A friend of mine on Ubuntu Touch reached out to me the other day about one of the older apps that I maintain. It's called Ambient, which is a simple app that plays background noise for a set period of time. Apparently, my friend uses it every night to help them sleep. One of the limitations of the app was that it had a max time of 3 hours, which, presumably, a person using this for a sleep aid would want to sleep longer than. They requested I update the app to longer timers.

Figuring this to be a one line change, and not an unreasonable request, by any means, I looked at the code:

ListItem {
                    height: timerSlider.height + timerSliderLabel.height + units.gu(1) + 50
                    Column {
                        id: timerSetter
                        spacing: units.gu(1)
                        width: parent.width - units.gu(2)
                        anchors.horizontalCenter: parent.horizontalCenter
                        anchors.bottom: parent.bottom
                        Label {
                            id: timerSliderLabel
                            text: "Sleep time: " + timerLabel.formatTime(Math.round(timerSlider.value) * 15);
                            fontSize: "large"
                            width: parent.width
                        }

                        Slider {
                            id: timerSlider
                            minimumValue: 1
                            maximumValue: 12
                            value: settings.contents.timer / 15
                            function formatValue(v) { return timerLabel.formatTime(Math.round(v) * 15); }
                            width: parent.width
                            onValueChanged: {
                                settings.contents = {timer: Math.round(value) * 15};
                            }
                        }
                    }
                }

Looks like it uses a slider that works on a min/max value of 1 to 12, and multiplies that by 15, which means the max time is 3 hours. A quick adjustment of maximumValue to 32 got me right where I needed to be at 8 hours total. Seemed to work well, and other than updating a few older Ubuntu.components to the new Lomiri.components, the app was done updating in no time. You can always check out the commits[1] if you'd like, and I put the newest version (1.6) on the openstore.

Linux - keep it simple.

[1] https://gitlab.com/alaskalinuxuser/ambient-ubuntu-phone/-/commits/master?ref_type=HEADS